package com.javatom.notes.seata.xa.order.controller;

import com.javatom.notes.seata.xa.order.pojo.CommonResult;
import com.javatom.notes.seata.xa.order.pojo.OrderPojo;
import com.javatom.notes.seata.xa.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @description:
 * @author: 曾维录
 * @time: 2020/8/19 17:50
 */
@RestController
@Slf4j
public class OrderContrller {
    @Resource
    private OrderService orderService;
    @GetMapping(value = "/insert")
    public CommonResult insert(@RequestParam("userId") Integer userId, @RequestParam("falg") Integer falg) {
        log.error("{}", userId);
        OrderPojo orderPojo = new OrderPojo();
        orderPojo.setFalg(falg);
        orderPojo.setUserId(userId);
        orderService.insert(orderPojo);
//        log.error("{}",1/0);
        return new CommonResult(200,"插入成功！");
    }
}
